//
// ITexture.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CRefCount;
import org.ryzom.nel.misc.IStream;

public class ITexture extends CRefCount {
  private long swigCPtr;

  public ITexture(long cPtr, boolean cMemoryOwn) {
    super(nel3dJNI.ITexture_SWIGUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

  public static long getCPtr(ITexture obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_ITexture(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public ITexture assign(ITexture tex) {
    return new ITexture(nel3dJNI.ITexture_assign(swigCPtr, this, ITexture.getCPtr(tex), tex), false);
  }

  public void setWrapS(ITexture.TWrapMode mode) {
    nel3dJNI.ITexture_setWrapS(swigCPtr, this, mode.swigValue());
  }

  public void setWrapT(ITexture.TWrapMode mode) {
    nel3dJNI.ITexture_setWrapT(swigCPtr, this, mode.swigValue());
  }

  public ITexture.TWrapMode getWrapS() {
    return ITexture.TWrapMode.swigToEnum(nel3dJNI.ITexture_getWrapS(swigCPtr, this));
  }

  public ITexture.TWrapMode getWrapT() {
    return ITexture.TWrapMode.swigToEnum(nel3dJNI.ITexture_getWrapT(swigCPtr, this));
  }

  public void setUploadFormat(ITexture.TUploadFormat pf) {
    nel3dJNI.ITexture_setUploadFormat(swigCPtr, this, pf.swigValue());
  }

  public ITexture.TUploadFormat getUploadFormat() {
    return ITexture.TUploadFormat.swigToEnum(nel3dJNI.ITexture_getUploadFormat(swigCPtr, this));
  }

  public void setFilterMode(ITexture.TMagFilter magf, ITexture.TMinFilter minf) {
    nel3dJNI.ITexture_setFilterMode(swigCPtr, this, magf.swigValue(), minf.swigValue());
  }

  public ITexture.TMagFilter getMagFilter() {
    return ITexture.TMagFilter.swigToEnum(nel3dJNI.ITexture_getMagFilter(swigCPtr, this));
  }

  public ITexture.TMinFilter getMinFilter() {
    return ITexture.TMinFilter.swigToEnum(nel3dJNI.ITexture_getMinFilter(swigCPtr, this));
  }

  public boolean mipMapOff() {
    return nel3dJNI.ITexture_mipMapOff(swigCPtr, this);
  }

  public boolean mipMapOn() {
    return nel3dJNI.ITexture_mipMapOn(swigCPtr, this);
  }

  public void touch() {
    nel3dJNI.ITexture_touch(swigCPtr, this);
  }

  public void touchRect(SWIGTYPE_p_NLMISC__CRect rect) {
    nel3dJNI.ITexture_touchRect(swigCPtr, this, SWIGTYPE_p_NLMISC__CRect.getCPtr(rect));
  }

  public boolean getReleasable() {
    return nel3dJNI.ITexture_getReleasable(swigCPtr, this);
  }

  public void setReleasable(boolean r) {
    nel3dJNI.ITexture_setReleasable(swigCPtr, this, r);
  }

  public void generate(boolean async) {
    nel3dJNI.ITexture_generate__SWIG_0(swigCPtr, this, async);
  }

  public void generate() {
    nel3dJNI.ITexture_generate__SWIG_1(swigCPtr, this);
  }

  public void validateGenerateFlag() {
    nel3dJNI.ITexture_validateGenerateFlag(swigCPtr, this);
  }

  public void release() {
    nel3dJNI.ITexture_release(swigCPtr, this);
  }

  public boolean supportSharing() {
    return nel3dJNI.ITexture_supportSharing(swigCPtr, this);
  }

  public String getShareName() {
    return nel3dJNI.ITexture_getShareName(swigCPtr, this);
  }

  public boolean setupedIntoDriver() {
    return nel3dJNI.ITexture_setupedIntoDriver(swigCPtr, this);
  }

  public void releaseDriverSetup() {
    nel3dJNI.ITexture_releaseDriverSetup(swigCPtr, this);
  }

  public boolean allowDegradation() {
    return nel3dJNI.ITexture_allowDegradation(swigCPtr, this);
  }

  public void serial(IStream f) {
    nel3dJNI.ITexture_serial(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public void selectTexture(long arg0) {
    nel3dJNI.ITexture_selectTexture(swigCPtr, this, arg0);
  }

  public boolean isSelectable() {
    return nel3dJNI.ITexture_isSelectable(swigCPtr, this);
  }

  public ITexture buildNonSelectableVersion(long arg0) {
    long cPtr = nel3dJNI.ITexture_buildNonSelectableVersion(swigCPtr, this, arg0);
    return (cPtr == 0) ? null : new ITexture(cPtr, false);
  }

  public boolean isTextureCube() {
    return nel3dJNI.ITexture_isTextureCube(swigCPtr, this);
  }

  public boolean isBumpMap() {
    return nel3dJNI.ITexture_isBumpMap(swigCPtr, this);
  }

  public boolean isBloomTexture() {
    return nel3dJNI.ITexture_isBloomTexture(swigCPtr, this);
  }

  public void setTextureCategory(SWIGTYPE_p_NLMISC__CSmartPtrT_NL3D__CTextureCategory_t textCat) {
    nel3dJNI.ITexture_setTextureCategory(swigCPtr, this, SWIGTYPE_p_NLMISC__CSmartPtrT_NL3D__CTextureCategory_t.getCPtr(textCat));
  }

  public void setRenderTarget(boolean enable) {
    nel3dJNI.ITexture_setRenderTarget(swigCPtr, this, enable);
  }

  public boolean getRenderTarget() {
    return nel3dJNI.ITexture_getRenderTarget(swigCPtr, this);
  }

  public SWIGTYPE_p_NL3D__ITexture__CTextureCategory getTextureCategory() {
    long cPtr = nel3dJNI.ITexture_getTextureCategory(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_NL3D__ITexture__CTextureCategory(cPtr, false);
  }

  public void setTextureDrvShare(SWIGTYPE_p_NLMISC__CRefPtrT_NL3D__CTextureDrvShare_t value) {
    nel3dJNI.ITexture_TextureDrvShare_set(swigCPtr, this, SWIGTYPE_p_NLMISC__CRefPtrT_NL3D__CTextureDrvShare_t.getCPtr(value));
  }

  public SWIGTYPE_p_NLMISC__CRefPtrT_NL3D__CTextureDrvShare_t getTextureDrvShare() {
    long cPtr = nel3dJNI.ITexture_TextureDrvShare_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_NLMISC__CRefPtrT_NL3D__CTextureDrvShare_t(cPtr, false);
  }

  public void set_ListInvalidRect(SWIGTYPE_p_std__listT_NLMISC__CRect_t value) {
    nel3dJNI.ITexture__ListInvalidRect_set(swigCPtr, this, SWIGTYPE_p_std__listT_NLMISC__CRect_t.getCPtr(value));
  }

  public SWIGTYPE_p_std__listT_NLMISC__CRect_t get_ListInvalidRect() {
    long cPtr = nel3dJNI.ITexture__ListInvalidRect_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_std__listT_NLMISC__CRect_t(cPtr, false);
  }

  public boolean isAllInvalidated() {
    return nel3dJNI.ITexture_isAllInvalidated(swigCPtr, this);
  }

  public boolean touched() {
    return nel3dJNI.ITexture_touched(swigCPtr, this);
  }

  public boolean filterOrWrapModeTouched() {
    return nel3dJNI.ITexture_filterOrWrapModeTouched(swigCPtr, this);
  }

  public void clearTouched() {
    nel3dJNI.ITexture_clearTouched(swigCPtr, this);
  }

  public void clearFilterOrWrapModeTouched() {
    nel3dJNI.ITexture_clearFilterOrWrapModeTouched(swigCPtr, this);
  }

  public final static class TWrapMode {
    public final static TWrapMode Repeat = new TWrapMode("Repeat", nel3dJNI.ITexture_Repeat_get());
    public final static TWrapMode Clamp = new TWrapMode("Clamp");
    public final static TWrapMode WrapModeCount = new TWrapMode("WrapModeCount");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TWrapMode swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TWrapMode.class + " with value " + swigValue);
    }

    private TWrapMode(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TWrapMode(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TWrapMode(String swigName, TWrapMode swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TWrapMode[] swigValues = { Repeat, Clamp, WrapModeCount };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

  public final static class TUploadFormat {
    public final static TUploadFormat Auto = new TUploadFormat("Auto", nel3dJNI.ITexture_Auto_get());
    public final static TUploadFormat RGBA8888 = new TUploadFormat("RGBA8888");
    public final static TUploadFormat RGBA4444 = new TUploadFormat("RGBA4444");
    public final static TUploadFormat RGBA5551 = new TUploadFormat("RGBA5551");
    public final static TUploadFormat RGB888 = new TUploadFormat("RGB888");
    public final static TUploadFormat RGB565 = new TUploadFormat("RGB565");
    public final static TUploadFormat DXTC1 = new TUploadFormat("DXTC1");
    public final static TUploadFormat DXTC1Alpha = new TUploadFormat("DXTC1Alpha");
    public final static TUploadFormat DXTC3 = new TUploadFormat("DXTC3");
    public final static TUploadFormat DXTC5 = new TUploadFormat("DXTC5");
    public final static TUploadFormat Luminance = new TUploadFormat("Luminance");
    public final static TUploadFormat Alpha = new TUploadFormat("Alpha");
    public final static TUploadFormat AlphaLuminance = new TUploadFormat("AlphaLuminance");
    public final static TUploadFormat DsDt = new TUploadFormat("DsDt");
    public final static TUploadFormat UploadFormatCount = new TUploadFormat("UploadFormatCount");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TUploadFormat swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TUploadFormat.class + " with value " + swigValue);
    }

    private TUploadFormat(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TUploadFormat(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TUploadFormat(String swigName, TUploadFormat swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TUploadFormat[] swigValues = { Auto, RGBA8888, RGBA4444, RGBA5551, RGB888, RGB565, DXTC1, DXTC1Alpha, DXTC3, DXTC5, Luminance, Alpha, AlphaLuminance, DsDt, UploadFormatCount };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

  public final static class TMagFilter {
    public final static TMagFilter Nearest = new TMagFilter("Nearest", nel3dJNI.ITexture_Nearest_get());
    public final static TMagFilter Linear = new TMagFilter("Linear");
    public final static TMagFilter MagFilterCount = new TMagFilter("MagFilterCount");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TMagFilter swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TMagFilter.class + " with value " + swigValue);
    }

    private TMagFilter(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TMagFilter(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TMagFilter(String swigName, TMagFilter swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TMagFilter[] swigValues = { Nearest, Linear, MagFilterCount };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

  public final static class TMinFilter {
    public final static TMinFilter NearestMipMapOff = new TMinFilter("NearestMipMapOff", nel3dJNI.ITexture_NearestMipMapOff_get());
    public final static TMinFilter NearestMipMapNearest = new TMinFilter("NearestMipMapNearest");
    public final static TMinFilter NearestMipMapLinear = new TMinFilter("NearestMipMapLinear");
    public final static TMinFilter LinearMipMapOff = new TMinFilter("LinearMipMapOff");
    public final static TMinFilter LinearMipMapNearest = new TMinFilter("LinearMipMapNearest");
    public final static TMinFilter LinearMipMapLinear = new TMinFilter("LinearMipMapLinear");
    public final static TMinFilter MinFilterCount = new TMinFilter("MinFilterCount");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TMinFilter swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TMinFilter.class + " with value " + swigValue);
    }

    private TMinFilter(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TMinFilter(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TMinFilter(String swigName, TMinFilter swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TMinFilter[] swigValues = { NearestMipMapOff, NearestMipMapNearest, NearestMipMapLinear, LinearMipMapOff, LinearMipMapNearest, LinearMipMapLinear, MinFilterCount };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
